<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title>订单列表</title>
		<link type="text/css" rel="stylesheet" href="/fontsawesome/css/font-awesome.css"/>
		<link type="text/css" rel="stylesheet" href="/css/datepicker.css"/>
		<link type="text/css" rel="stylesheet" href="/css/style.css"/>
		<link type="text/css" rel="stylesheet" href="/css/demo.css"/>
	</head>
	<body>
		<div class="main_box">
			<h2><span></span>订单列表</h2>
			<form method="post" id="order_shform">
				<div class="search_box clearfix">
					<label class="f_left">供货商名称：</label>
					<input type="text" class="f_left" name="name" placeholder="输入供货商名字或法人" th:value="${provider?.name}" style="margin-right:15px;"/>
					<label class="f_left">供应商：</label>
					<select name="id" class="carbrand" required>
						<option value="">请选择</option>
						<option th:each="t,line : ${providerList}" th:value="${t.id}" th:text="${t.name}"
								th:selected="${provider?.id == t.id}"></option>
					</select>
					<input type="button" value="搜索" class="btn blue_btn search"/>
				</div>
			</form>

			<div th:class="${updateClass }" th:text="${updateMsg }"></div>

			<div class="cont_box">
				<table border="0" cellspacing="0" cellpadding="0" class="table">
				<thead>
					<tr>
						<th>编号</th>
						<th>公司名称</th>
						<th>公司法人</th>
						<th>成立时间</th>
						<th>传真号</th>
						<th width="300">操作</th>
					</tr>
				</thead>
				<tbody>
				<tr th:each="t,line : ${paPro?.items}">
					<td><span th:text="${t.id }"></span></td>
					<td><span th:text="${t.name }"></span></td>
					<td><span th:text="${t.boss }"></span></td>
					<td><span th:text="${#dates.format(t.createDay, 'yyyy-MM-dd')}"></span></td>
					<td><span th:text="${t.faxNum }"></span></td>
					<td th:id="${t.id}" th:name="${t.name}">
						<a href="javascript:void(0);" class="table_btn table_info detail_btn">
							<i class="fa fa-eye"></i>
							<span>查看信息</span>
						</a>
						<a href="javascript:void(0);" class="table_btn table_edit edit_btn">
							<i class="fa fa-edit"></i>
							<span>修改信息</span>
						</a>
						<a href="javascript:void(0);" class="table_btn table_del del_btn" >
							<i class="fa fa-recycle"></i>
							<span>删除信息</span>
						</a>
					</td>
				</tr>
				</tbody>
			</table>
		</div>

			<div class="page-bar">
				<ul class="page-num-ul clearfix">
					<li th:object="${paPro}">&nbsp;&nbsp;
						<span th:text="|共*{count}条记录|"></span>&nbsp;&nbsp;
						<span th:text="|第*{curr}页 / 共*{total}页|"></span>
					</li>&nbsp;&nbsp;&nbsp;

					<a href="javascript:void(0)" title="首页">
						<i class="fa fa-chevron-circle-up"></i>
					</a>&nbsp;
					<a href="javascript:void(0)" title="上一页">
						<i class="fa fa-chevron-circle-left"></i>
					</a>&nbsp;
					<a href="javascript:void(0)" title="下一页">
						<i class="fa fa-chevron-circle-right"></i>
					</a>&nbsp;
					<a href="javascript:void(0)" title="尾页">
						<i class="fa fa-chevron-circle-down"></i>
					</a>
				</ul>

				<span class="page-go-form">
					<select class="f_left" id="curr">
					<option th:each="t,line:${selectByPage}" th:value="${line.index+1}"
							th:text="|第${line.index+1}页|" th:selected="${paPro?.curr == line.index+1}"></option>
				</select>

				<input type="button" value="跳转" class="btn blue_btn search"/>

				</span>

			</div>
		</div>
		<!--javascript include-->
		<script src="/js/jquery-2.2.1.min.js"></script>
		<script src="/js/jquery.dataTables.min.js"></script>
		<script src="/js/bootstrap-datepicker.js"></script>
		<script src="/js/jquery.validate.min.js"></script>
		<script src="/js/other.js"></script>
		<script src="/js/jump.js"></script>
		<script>
			$(".update-suc,.update-err").slideUp(1000*2);
		</script>

		<!-- 分页和条件查询 -->
		<script type="text/javascript" th:inline="javascript">
			var curr = [[${paPro?.curr ?: 1}]];
			var total = [[${paPro?.total ?: 0}]];

			if (total == 0){
				$(".page-num-ul a").hide();
			}
			//判断, 是否是第一页
			if(curr == 1){
				$(".page-num-ul a:lt(2)").hide();
			}
			//判断, 是否是最后一页
			if(curr == total){
				$(".page-num-ul a:gt(1)").hide();
			}


			$(".page-num-ul a:eq(0)").bind("click", function() {
				toJump1("/provider/query", "selectDate" + "&curr=1");

			});
			$(".page-num-ul a:eq(1)").bind("click", function() {
				toJump1("/provider/query", $("#order_shform").serialize() + "&curr=[[${paPro.curr-1}]]");
			});
			$(".page-num-ul a:eq(2)").bind("click", function() {
				toJump1("/provider/query", $("#order_shform").serialize() + "&curr=[[${paPro.curr+1}]]");
			});
			$(".page-num-ul a:eq(3)").bind("click", function() {
				toJump1("/provider/query", $("#order_shform").serialize() + "&curr=[[${paPro.total}]]");
			});

			$(":button[value='跳转']").bind("click", function() {
				//获取跳转目标页码
				var target = $("#curr").val();
				//跳转
				toJump1("/provider/query", $("#order_shform").serialize() + "&curr="+target);
			});

		</script>



		<script>

		$(":button[value='搜索']").bind("click",function () {
				toJump1("/provider/query",$("#order_shform").serialize());
			})

		$(".edit_btn").bind("click",function () {
			var id = $(this).parent().attr("id");
			toJump1("/provider/updatePage","id="+id);
		})


		$(function(){
			$("body").tipWindow({method:"delete",Class:".del_btn",even:"click",deleteTxt:"确认要删除该供货商吗？"
                ,Twidth:"400",Theight:"180",delUrl:"/provider/delete"});//delUrl 退单请求地址
			$("body").tipWindow({method:"edit",Class:".detail_btn",even:"click",orderId:"id",
				Twidth:"600",Theight:"500",tipTit:"供货商信息",editUrl:"/provider/view"});
		});


		</script>
	</body>
</html>
